local skel = fk.CreateSkill {
  name = "efengqi__zixi",
}

Fk:loadTranslationTable{
  ["efengqi__zixi"] = "姊希",
  [":efengqi__zixi"] = "每回合开始时，你可以将一张“琴”置入当前回合角色的判定区，然后其获得其场上所有与此牌花色相同的牌。",

  ["#efengqi__zixi-invoke"] = "姊希：你可以将一张“琴”置入 %src 判定区，然后其获得其场上与之花色相同的牌",
}

skel:addEffect(fk.TurnStart, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    if not target.dead and player:hasSkill(skel.name) then
      return not player:isKongcheng() and not table.contains(target.sealedSlots, Player.JudgeSlot)
    end
  end,
  on_cost = function(self, event, target, player, data)
    local ids = table.filter(player:getCardIds("he"), function(id) return Fk:getCardById(id):getMark("@@efengqi__qiqin") ~= 0 end)
    local cards = player.room:askToCards(player, {
      min_num = 1, max_num = 1, skill_name = skel.name, include_equip = true, pattern = tostring(Exppattern{ id = ids }),
      prompt = "#efengqi__zixi-invoke:"..target.id
    })
    if #cards > 0 then
      event:setCostData(self, {cards = cards, tos = {target} } )
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cid = event:getCostData(self).cards[1]
    local card = Fk:cloneCard("indulgence")
    card:addSubcard(cid)
    target:addVirtualEquip(card)
    room:moveCardTo(cid, Player.Judge, target, fk.ReasonJustMove, skel.name)
    if target.dead then return end
    local get = table.filter(target:getCardIds("ej"), function (id)
      return Fk:getCardById(id).suit == Fk:getCardById(cid).suit
    end)
    if #get > 0 then
      room:delay(400)
      room:moveCardTo(get, Player.Hand, target, fk.ReasonJustMove, skel.name, nil, true, target)
    end
  end,
})



return skel
